﻿@using YanForum.Engine.ViewModels
@model UserItem

@{
    ViewBag.Title = "Cập nhật thông tin";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
@Styles.Render("~/Content/fileUpload")
<link href="/Content/jquery.Jcrop.min.css" rel="stylesheet" />

<div class="row">
    <div class="col-sm-8">
        @using (Html.BeginForm("Index", "AccountAdmin", new { area = "Admin" }, FormMethod.Post, new { @class = "form-horizontal", enctype = "multipart/form-data" }))
        {
            @Html.AntiForgeryToken()
            @Html.ValidationSummary()
            if (ViewBag.Success != null)
            {
            <div class="alert alert-info">@ViewBag.Success</div>
            }
            
            <div class="form-group">
                <label class="col-sm-3">Tên đăng nhập</label>
                <div class="col-sm-6">
                    @Html.TextBoxFor(m => m.UserName, new { @class = "form-control", @readonly = "readonly" })
                    @Html.HiddenFor(r => r.UserId)
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3">Email</label>
                <div class="col-sm-6">
                    @Html.TextBoxFor(m => m.Email, new { @class = "form-control", @readonly = "readonly" })
                    @Html.ValidationMessageFor(m => m.Email)
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3">Tên đầy đủ</label>
                <div class="col-sm-6">
                    @Html.TextBoxFor(m => m.FullName, new { @class = "form-control" })
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3">Avatar</label>
                <div class="col-sm-6">
                    <span class="btn btn-success fileinput-button">
                        <i class="glyphicon glyphicon-plus"></i>
                        <span>Chọn file</span>
                        <input id="fileupload" type="file" name="fileAvatar">
                    </span>
                    <!-- The global progress bar -->
                    <div id="progress" class="progress" style="margin-top: 10px;">
                        <div class="progress-bar progress-bar-success"></div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-offset-3 col-sm-9">
                        <!-- The container for the uploaded files -->
                        <div id="filesUploaded" class="files">
                            @if(!string.IsNullOrEmpty(Model.AvatarFullPath) && Model.ImagePath != "/"){
                                <img id="avatarDrop"  src="@Model.AvatarFullPath" />
                            }
                        </div>
                        @Html.HiddenFor(r=>r.ImagePath)
                    </div>
                </div>
                <div class="row" style="margin-top: 10px;">
                    <div class="col-sm-offset-3 col-sm-9">
                        <input type="button" class="btn btn-success" id="btnDrop" onclick="return startDrop();" value="Tỷ lệ 1x1" />
                        <input type="button" class="btn btn-success" id="btnSaveDrop" value="Upload Hình" onclick="return saveDrop();" />
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-3 col-sm-6">
                    <button type="submit" class="btn btn-default">Cập nhật</button>
                </div>
            </div>
        }
    </div>
    <div class="col-md-4">
        <section id="externalLogins">
            @Html.Action("ExternalLoginsList", "Account", new { area = "", ReturnUrl = ViewBag.ReturnUrl })
        </section>
    </div>
</div>
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script src="/Scripts/jquery.Jcrop.min.js"></script>
    @Scripts.Render("~/bundles/fileUpload")
}